Skip to content

Fix enum and map of enum issue (regression)#1706

Merged
wing328 merged 1 commit into
masterfrom
swift-fix-issue
Dec 20, 2018
Merged

Fix enum and map of enum issue (regression)#1706
wing328 merged 1 commit into
masterfrom
swift-fix-issue

Conversation

@wing328

@wing328 wing328 commented Dec 18, 2018

Copy link
Copy Markdown
Member

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Issue (regression) due to PR fixing hasMore in various CodegenProperty list.

@d-date

d-date commented Dec 19, 2018

Copy link
Copy Markdown

@wing328 Still have regression for map_of_enum_string .

MapTest:
    type: object
    properties:
      map_map_of_string:
        type: object
        additionalProperties:
          type: object
          additionalProperties:
            type: string
      # comment out the following (map of map of enum) as many language not yet support this
      #map_map_of_enum:
      #  type: object
      #  additionalProperties:
      #    type: object
      #    additionalProperties:
      #      type: string
      #      enum:
      #        - UPPER
      #        - lower
      map_of_enum_string:
        type: object
        additionalProperties:
          type: string
          enum:
            - UPPER
            - lower
      direct_map:
        type: object
        additionalProperties:
          type: boolean
      indirect_map:
        $ref: "#/definitions/StringBooleanMap"

screen shot 2018-12-19 at 12 56 56

@wing328

wing328 commented Dec 19, 2018

Copy link
Copy Markdown
Member Author

@d-date I couldn't repeat the issue locally. Here is what I got for samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift:

//
// MapTest.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//

import Foundation



public struct MapTest: Codable {

    public enum MapOfEnumString: String, Codable {
        case upper = "UPPER"
        case lower = "lower"
    }
    public var mapMapOfString: [String:[String:String]]?
    public var mapOfEnumString: [String:String]?
    public var directMap: [String:Bool]?
    public var indirectMap: [String:Bool]?

    public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: [String:Bool]?) {
        self.mapMapOfString = mapMapOfString
        self.mapOfEnumString = mapOfEnumString
        self.directMap = directMap
        self.indirectMap = indirectMap
    }

    public enum CodingKeys: String, CodingKey {
        case mapMapOfString = "map_map_of_string"
        case mapOfEnumString = "map_of_enum_string"
        case directMap = "direct_map"
        case indirectMap = "indirect_map"
    }


}

Can you give it another try by cloning the repo again and then building the JAR locally from this branch?

@d-date

d-date commented Dec 20, 2018

Copy link
Copy Markdown

@wing328 Sorry, it's my mistake. I forget to rebuild maven, so you are correct😅

@wing328

wing328 commented Dec 20, 2018

Copy link
Copy Markdown
Member Author

@d-date no worries. Thanks again for reporting the issue and testing the fix.

@wing328 wing328 merged commit f188fa0 into master Dec 20, 2018
@wing328 wing328 deleted the swift-fix-issue branch December 20, 2018 08:07
A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants